os_return:
	pushf
	pop word [gs:flags_tmp]

	cmp byte [gs:internal_call], 1
	jge .internal_return
	
	mov word [gs:return_ax_tmp], ax
		
	mov ax, fs
	mov ds, ax
	mov es, ax
 
	pop ax
	push 0x2000
	push ax
	
	mov ax, [gs:return_ax_tmp]
	
	push word [gs:flags_tmp]
	popf
	
	retf

	.internal_return:
		ret

flags_tmp			dw 0
internal_call			dw 0		; cancels os_return
return_ax_tmp			dw 0